<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script type="text/javascript" src="/webjars/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<button id="btnId">SayHello</button>
<form action="/user" method="post">
    username:<input type="text" name="username"><br>
    tel:<input type="text" name="telephone"><br>
    <input type="submit" value="注册">
</form>
<script>
    //使用$()代替window.onload
    $(function(){
        //使用选择器获取按钮对象，随后绑定单击响应函数
        $("#btnId").click(function(){
            //弹出Hello
            alert('Hello');
        });
    });
</script>
</body>
</html>